package com.testmanager.testmananger.pagetest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

//https://www.cnblogs.com/hdwang/p/7843405.html
//https://www.cnblogs.com/hhhshct/p/9476542.html
@RestController
@RequestMapping("/pagetest")

public class BookResource {

    @Autowired
    BookRepositoryCustom bookRepositoryCustom;
    @PostMapping("test")
    public Page<BookEntity> getbook(@RequestParam(name = "index",defaultValue = "0")int index ,@RequestParam(name = "size",defaultValue = "10")int size,
                                  @RequestBody BookEntity bookEntity){
        Page<BookEntity> search = bookRepositoryCustom.search(bookEntity, index, size);
        return search;
    }

}
